<%-- 
    Document   : AddTraining
    Created on : May 2, 2014, 12:12:12 PM
    Author     : mishra
--%>

<%@page import="Course.CourseBean"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.Vector"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
    try {
        if (session.getAttribute("uid") != null) {
            if (session.getAttribute("Manage_Training").toString().equals("1")) {
%>
<%String to = "", status = "", msg = "", admissionId = "";%>
<!DOCTYPE html>
<html>
    <head>
        <title>Ramgovind Automated System</title>

        <link rel="stylesheet" href="/RIT/css/bootstrap.css">
        <link rel="stylesheet" href="/RIT/css/bootstrap-responsive.css">
        <link rel="stylesheet" href="/RIT/css/jquery.fancybox.css">
        <link rel="stylesheet" href="/RIT/css/style.css">
        <link rel="stylesheet" href="/RIT/css/iconfont.css">
        <link rel="stylesheet" href="/RIT/css/bootstrap.datepicker.css">
        <script src="../../ajax/ajax.js"></script>
        <script>
            function streamName(trg, val) {
                document.getElementById(trg).value = val;
            }
        </script>
    </head>
    <body>
        <%@include file="/topheader.html" %>
        <%@include file="/servicesheader.html" %>
        <div class="main">
            <div class="container-fluid">
                <%@include file="/Services/Placement/placementsidenav.html" %>
                <div class="content">
                    <%if (session.getAttribute("status") != null) {
                            status = session.getAttribute("status").toString();
                            msg = session.getAttribute("msg").toString();
                    %>
                    <div class="alert alert-info alert-block">
                        <a class="close" data-dismiss="alert" href="#"><img src="/RIT/img/mclose.png"></a>
                        <h4 class="alert-heading"> <%=status%></h4>
                        <%=msg%>

                    </div>
                    <%session.removeAttribute("status");
                            session.removeAttribute("msg");
                        }%>
                    <div class="row-fluid">
                        <div class="span12">
                            <div class="box">
                                <div class="box-head">
                                    <h3>Add Training</h3>
                                    <a href="Training.jsp">
                                        <button style="float: right" class="btn btn-success">View Training</button>
                                    </a>
                                </div>

                                <form action="/RIT/AddTraining" method="post" class='validate form-horizontal'>
                                    <div class="box-content">
                                        <!---Form Start....-->

                                        <div id="lside" style="float: left; margin-top: 10px; width: 48%;">
                                            <div class="control-group">
                                                <label for="coname" class="control-label">Company Name<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <input type="text" name="coname" id="coname" class='required'>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="pno" class="control-label">Phone No.<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <input type="text" name="pno" id="pno" class='required'>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="sdate" class="control-label">Start Date<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <div class="input-append">
                                                        <input type="text" name="sdate" class='datepick required' id="sdate" readonly>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="timefrom" class="control-label">Time From<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <input type="text" name="timefrom" id="timefrom" class='required'>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="course" class="control-label">Course<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <select name="course" id="course" class='{required:true}'onchange="getStream('stream', this.value), getCoursePeriod(this.value, 'subYear')">
                                                        <option value=''>Choose one</option>
                                                        <%{
                                                                Vector<Object> list = new Vector<Object>();
                                                                list = Course.Query.viewAlldistinct();
                                                                CourseBean ctb = new CourseBean();
                                                                if (!list.isEmpty()) {
                                                                    Iterator it = list.iterator();
                                                                    while (it.hasNext()) {
                                                                        ctb = (CourseBean) it.next();
                                                        %>
                                                        <option value='<%=ctb.getCourseName()%>'><%=ctb.getCourseName()%></option>
                                                        <%}
                                                            }
                                                        %>
                                                        <%}%>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="coordinat" class="control-label">Coordinator<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <input type="text" name="coordinat" id="coordinat" class='required'>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="cadd" class="control-label">Company Address<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <textarea name="cadd" id="cadd" class='required'></textarea>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="desc" class="control-label">Description</label>
                                                <div class="controls">
                                                    <textarea name="desc" id="desc"></textarea>
                                                </div>
                                            </div>
                                        </div>

                                        <div id="rside" style="float: left; margin-right: 0px; margin-top: 10px; ">
                                            <div class="control-group">
                                                <label for="title" class="control-label">Training Title<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <input type="text" name="title" id="title" class='required'>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="email" class="control-label">Company Email<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <div class="input-append">
                                                        <input type="text" name="email" id="email" placeholder="info@sitename.com" class='{required:true} email' style="width: 181px;"><span class="add-on "><i class="ficon-mail3"></i></span>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="edate" class="control-label">End Date<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <div class="input-append">
                                                        <input type="text" name="edate" class='datepick required' id="edate" readonly>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="timeto" class="control-label">Time To<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <input type="text" name="timeto" id="timeto" class='required'>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="stream" class="control-label">Stream<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <select name="stream" id="stream" onchange="streamName('streamname', this.options[this.selectedIndex].text)" class='{required:true}' >
                                                        <option value="">Select Stream</option>
                                                    </select>
                                                    <input type="hidden" id="streamname" name="streamname">
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="tcost" class="control-label">Training Cost<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <input type="text" name="tcost" id="tcost" class='required'>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="seats" class="control-label">No of Seats<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <input type="text" name="seats" id="seats" class='required'>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="tlocation" class="control-label">Training Location<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <textarea name="tlocation" id="tlocation" required></textarea>
                                                </div>
                                            </div>
                                            
                                        </div>
                                        <!---Form Ends....-->
                                    </div>
                                    <div class="form-actions">
                                        <input type="submit" class='btn btn-primary'>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>

                </div>	
            </div>
        </div>

        <script src="/RIT/js/jquery.js"></script>
        <script src="/RIT/js/less.js"></script>
        <script src="/RIT/js/bootstrap.min.js"></script>
        <script src="/RIT/js/jquery.uniform.min.js"></script>
        <script src="/RIT/js/bootstrap.timepicker.js"></script>
        <script src="/RIT/js/bootstrap.datepicker.js"></script>
        <script src="/RIT/js/chosen.jquery.min.js"></script>
        <script src="/RIT/js/jquery.fancybox.js"></script>
        <script src="/RIT/js/plupload/plupload.full.js"></script>
        <script src="/RIT/js/plupload/jquery.plupload.queue/jquery.plupload.queue.js"></script>
        <script src="/RIT/js/jquery.cleditor.min.js"></script>
        <script src="/RIT/js/jquery.inputmask.min.js"></script>
        <script src="/RIT/js/jquery.tagsinput.min.js"></script>
        <script src="/RIT/js/jquery.mousewheel.js"></script>
        <script src="/RIT/js/jquery.textareaCounter.plugin.js"></script>
        <script src="/RIT/js/ui.spinner.js"></script>
        <script src="/RIT/js/jquery.jgrowl_minimized.js"></script>
        <script src="/RIT/js/jquery.form.js"></script>
        <script src="/RIT/js/jquery.validate.min.js"></script>
        <script src="/RIT/js/bbq.js"></script>
        <script src="/RIT/js/jquery-ui-1.8.22.custom.min.js"></script>
        <script src="/RIT/js/jquery.form.wizard-min.js"></script>
        <script src="/RIT/js/jquery.cookie.js"></script>
        <script src="/RIT/js/jquery.metadata.js"></script>
        <script src="/RIT/js/custom.js"></script><script src="/RIT/js/demo.js"></script>
        <script src="/RIT/js/iconfont.js"></script>
    </body>
</html>
<%
} else {
    out.println("<script>alert('" + session.getAttribute("Enquiry") + "')</script>");
%>
<script type="text/javascript">
                                                        alert("You Are Not Authorised");
                                                        window.history.back();
</script>
<%
            }
        } else {
            request.setAttribute("msg", "You Are Not Authorised! Please Contact to System Administrator!");
            request.setAttribute("value", "0");
            getServletContext().getRequestDispatcher("/index.jsp").forward(request, response);
        }
    } catch (Exception e) {
        request.setAttribute("msg", "Please Contact to System Administrator!");
        request.setAttribute("value", "0");
        getServletContext().getRequestDispatcher("/index.jsp").forward(request, response);
    }
%>
